amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests
authorRoger Pau Monné <roger.pau@citrix.com>
Mon, 15 Aug 2022 07:58:08 +0000 (09:58 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 15 Aug 2022 07:58:08 +0000 (09:58 +0200)
commita2eeaa6906101fbf322766f37f8f061dd36fe58d
tree1cd6cb73b9bb49748960ce6bc0b18eeec88e4b2c
parentebaaa72ee080c8774b1df5783220d4811159c327
amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests

Allow HVM guests access to MSR_VIRT_SPEC_CTRL if the platform Xen is
running on has support for it.  This requires adding logic in the
vm{entry,exit} paths for SVM in order to context switch between the
hypervisor value and the guest one.  The added handlers for context
switch will also be used for the legacy SSBD support.

Introduce a new synthetic feature leaf (X86_FEATURE_VIRT_SC_MSR_HVM)
to signal whether VIRT_SPEC_CTRL needs to be handled on guest
vm{entry,exit}.

Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/cpuid.c
xen/arch/x86/hvm/svm/entry.S
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/include/asm/cpufeatures.h
xen/arch/x86/include/asm/msr.h
xen/arch/x86/msr.c
xen/arch/x86/spec_ctrl.c